package design_pattern.factory.simpleFactory;

/**
 * @version 1.0.0
 * Created by cyd on 2022-06-06 14:54:04
 * @ClassName : design_pattern.factory.simpleFactory.Factory
 * @Description : 操作工厂，用于生产操作符（产品）
 */
public class OperationFactory {

    public static Operation getInstance(String flag) {
        Operation operation = null;

        switch (flag) {
            case "+":
                operation = new OperationAdd();
                break;

            case "-":
                operation = new OperationMul();
                break;

            default:
                break;
        }
        return operation;
    }
}
